package com.ghp.common.model.dto;

import com.ghp.common.constants.SystemConstants;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author ghp
 * @title
 * @description
 */
@Data
public class PageDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 当前页号
     */
    @ApiModelProperty(value = "当前页码", required = true)
    private Long currentPage;

    /**
     * 页面大小
     */
    @ApiModelProperty(value = "每页大小", required = true)
    private Long pageSize;

    /**
     * 排序字段
     */
    @ApiModelProperty(value = "排序字段")
    private String sortField;

    /**
     * 排序顺序（默认升序）
     */
    @ApiModelProperty(value = "排序顺序， 默认是降序排序desc", example = "desc/asc")
    private String sortOrder;

    public PageDTO() {
        // 默认分页
        this.currentPage = 1L;
        this.pageSize = 5L;
        // 默认排序为降序
        this.sortOrder = SystemConstants.SORT_ORDER_DESC;
        // 默认排序字段是 updateTime
        this.sortField = "update_time";
    }
}
